<template>
    <view>
        <!-- parse <include src="../component/navigationBar.wxml"></include> -->
        <block>
            <view class="navigationBox" :style="'padding-top:' + nTop + 'px;height:' + nHeight + 'px;line-height:' + nHeight + 'px;--color:' + color + ';'">
                <view class="nBar" :style="'height:' + nHeight + 'px;top:' + nTop + 'px'">
                    <navigator class="ico" hoverClass="none" :openType="pages.length == 1 ? 'switchTab' : 'navigateBack'" :url="pages.length == 1 ? '/pages/index/index4' : ''">
                        {{ pages.length == 1 ? '' : '' }}
                    </navigator>
                    <view class="title">{{ nTitle }}</view>
                </view>
            </view>
        </block>
        <scroll-view
            @refresherrefresh="onPullDownRefresh"
            @scroll="binnd_scroll"
            class="list"
            :enableBackToTop="true"
            :enableFlex="true"
            lowerThreshold="50"
            :refresherEnabled="true"
            :refresherTriggered="triggered"
            :scrollTop="scrolltopNum_index"
            :scrollWithAnimation="true"
            :scrollY="true"
            :style="'margin-top:' + nTH + 'px;height:-webkit-calc(100vh - ' + nTH + 'px);--color:' + color + ';--rgbcolor:' + rgbcolor + ';'"
            v-if="flag != 0"
        >
<!--            <view class="TG_BANG box">
                <view class="tbody_img" :style="'background:url(' + WWW + '/res/m/img/tg_tbody.png)left top/100% 100% no-repeat;'">收益榜</view>
                <block v-if="BANG.length > 0">
                    <view class="ul">
                        <text class="li">排名</text>
                        <text class="li">推广经纪人</text>
                        <text class="li">收益(元)</text>
                    </view>
                    <view class="dl" v-for="(item, index) in BANG" :key="index">
                        <view class="ul C">
                            <view class="li">
                                <text :class="'i ico i' + item.i">{{ item.i <= 3 ? '' : item.i }}</text>
                            </view>
                            <view class="li">
                                <view class="span">
                                    <image class="logo" :src="item.gradeico"></image>
                                    {{ item.nickname }}
                                </view>
                            </view>
                            <view class="li">{{ item.money }}</view>
                        </view>
                    </view>
                </block>
                <view class="nodata" v-else>
                    <image mode="aspectFit" src="/static/res/img/nodata.png"></image>
                    收益排名正在路上
                </view>
            </view>-->
            <view class="box">
                <view class="tbody_img" :style="'background:url(' + WWW + '/res/m/img/tg_tbody.png)left top/100% 100% no-repeat;'">三步开启收益</view>
                <view class="TG_STEP">
                    <text class="i ico reg"></text>
                    <view class="div">
                        <view class="h3">{{ STEP.step1.t }}</view>
                        <view class="h4">{{ STEP.step1.c }}</view>
                    </view>
                </view>
                <view class="TG_STEP">
                    <text class="i ico share"></text>
                    <view class="div">
                        <view class="h3">{{ STEP.step2.t }}</view>
                        <view class="h4">{{ STEP.step2.c }}</view>
                    </view>
                </view>
                <view class="TG_STEP">
                    <text class="i ico money"></text>
                    <view class="div">
                        <view class="h3">{{ STEP.step3.t }}</view>
                        <view class="h4">{{ STEP.step3.c }}</view>
                    </view>
                </view>
            </view>
            <view @tap="tghbFn" class="TG_BANGabtn btn5 ico"> 立即推广</view>
            <view class="blank">　</view>
        </scroll-view>
        <!-- parse <include src="TG_btm_nav.wxml"></include> -->
        <block>
            <view
                class="btm_nav"
                :style="'--color:' + color + ';--rgbcolor:' + rgbcolor + ';--btmnavbg_color:' + btmnavbg_color + ';--btmnavbg_rgbcolor:' + btmnavbg_rgbcolor + ';'"
            >
                <view class="shadow"></view>
                <view class="navabox">
                    <navigator :class="'a ' + (btm_nav == 'index' ? ' ed' : '')" hoverClass="none" openType="redirect" :url="'index?tguid=' + tguid + '&admid=' + admid">
                        <view class="i">
                            <view class="image ico"></view>
                        </view>
                        <view class="font">首页</view>
                    </navigator>
                    <navigator :class="'a ' + (btm_nav == 'help' ? ' ed' : '')" hoverClass="none" openType="redirect" :url="'help?tguid=' + tguid + '&admid=' + admid">
                        <view class="i">
                            <view class="image ico"></view>
                        </view>
                        <view class="font">帮助</view>
                    </navigator>
                    <navigator :class="'a ' + (btm_nav == 'msg' ? ' ed' : '')" hoverClass="none" openType="redirect" :url="'msg?tguid=' + tguid + '&admid=' + admid">
                        <view class="i">
                            <view class="image ico"></view>
                            <text class="span" v-if="btm_nav_msg_num > 0">{{ btm_nav_msg_num }}</text>
                        </view>
                        <view class="font">通知</view>
                    </navigator>
                    <navigator :class="'a ' + (btm_nav == 'my' ? ' ed' : '')" hoverClass="none" openType="redirect" :url="'my?tguid=' + tguid + '&admid=' + admid">
                        <view class="i">
                            <view class="image ico"></view>
                        </view>
                        <view class="font">我的</view>
                    </navigator>
                </view>
            </view>
            <view @tap="backtopFn" class="backtop fadeInUp" data-id="index" :style="'color:' + color" v-if="backtop_flag">
                <text class="ico icon-backtop"></text>
                顶部
            </view>
        </block>
    </view>
</template>
<script module="WXS" lang="wxs" src="@/res/www.a9a.cn.wxs"></script>
<script>
var t = require('../../@babel/runtime/helpers/defineProperty');
var a = require('../../res/www.a9a.cn.js');
var app = getApp();
export default {
    data() {
        return {
            nTitle: '推广中心',
            btm_nav: 'index',
            btmnavbg_color: '#B8BCCC',
            btmnavbg_rgbcolor: a.c16_rgb('#B8BCCC'),
            triggered: true,
            loading_flag: false,
            loading_ico_flag: false,
            loading_str: '玩命加载中',
            color: '',
            rgbcolor: '',
            WWW: '',
            tguid: '',
            admid: '',
            LIST: [],
            nodata: false,
            t: 0,
            keyword: '',
            btm_nav_msg_num: '',
            cook_tg_id: '',
            cook_tg_flag: '',
            MB: '',
            BANG: '',

            STEP: {
                step1: {
                    t: '',
                    c: ''
                },

                step2: {
                    t: '',
                    c: ''
                },

                step3: {
                    t: '',
                    c: ''
                }
            },

            SHARE: '',
            flag: '',
            backtop_flag: false,
            nTop: '',
            nHeight: '',
            pages: [],
            scrolltopNum_index: 0,
            nTH: ''
        };
    },
    onLoad: function (t) {
        var that = this;
        var n = 0;
        var o = 0;
        uni.setNavigationBarTitle({
            title: that.nTitle
        });
        app.globalData.get_config('_ZEAI').then(function (t) {
            that.setData({
                color: app.globalData._ZEAI.color,
                rgbcolor: a.c16_rgb(app.globalData._ZEAI.color),
                WWW: app.globalData.WWW
            });
        });
        app.globalData.get_navigationBarTopHeight(that);
        if (a.ifint(t.tguid) || a.ifint(t.admid)) {
            n = a.ifint(t.tguid) ? t.tguid : 0;
            o = a.ifint(t.admid) ? t.admid : 0;
        }
        that.setData({
            tguid: n,
            admid: o
        });
        this.init();
    },
    onPullDownRefresh: function () {
        var that = this;
        uni.vibrateShort({
            type: 'heavy'
        });
        setTimeout(function () {
            that.setData({
                triggered: false,
                loading_flag: false,
                loading_str: '拼命加载中',
                LIST: [],
                nodata: false,
                t: 0,
                keyword: ''
            });
            that.setloading('end', '拼命加载中');
            2;
            ({});
            that.init();
        }, 500);
    },
    onShareAppMessage: function (t) {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            path: '/hnPages/tg/index'
        };
    },
    onShareTimeline: function () {
        return {
            imageUrl: this.SHARE.imgurl,
            title: this.SHARE.title,
            query: '',
            path: '/hnPages/tg/index'
        };
    },
    methods: {
        init: function () {
            var that = this;
            uni.showLoading({
                title: '玩命加载中...',
                mask: true
            });
            false;
            var e = {
                submitok: 'INDEX',
                openid: uni.getStorageSync('COOK_U').openid,
                tguid: that.tguid,
                admid: that.admid
            };
            app.globalData.ajax({
                url: 'tg.php',
                data: e,
                success: function (i) {
                    uni.hideLoading();
                    1 == i.flag
                        ? (uni.setNavigationBarTitle({
                              title: i.nTitle
                          }),
                          that.setData({
                              nTitle: i.nTitle,
                              btm_nav_msg_num: i.btm_nav_msg_num,
                              cook_tg_id: i.D.cook_tg_id,
                              cook_tg_flag: i.D.cook_tg_flag,
                              MB: i.MB,
                              BANG: i.BANG,
                              STEP: i.STEP,
                              SHARE: i.SHARE,
                              flag: i.flag
                          }))
                        : (that.setData({
                              flag: i.flag
                          }),
                          (i.this = that),
                          (i.url = 'no'),
                          a.sorry(i));
                }
            });
        },

        tghbFn: function () {
            a.empty(this.MB) || app.globalData.openSetting(this.MB);
            1 == this.cook_tg_flag
                ? uni.navigateTo({
                      url: '/hnPages/tg/my_ewm?tguid=' + this.cook_tg_id + '&admid=' + this.admid
                  })
                : uni.redirectTo({
                      url: '/hnPages/tg/my?tguid=' + this.tguid + '&admid=' + this.admid
                  });
        },

        setloading: function (t, a) {
            'start' == t
                ? this.setData({
                      loading_flag: true,
                      loading_ico_flag: true,
                      loading_str: a
                  })
                : this.setData({
                      loading_flag: false,
                      loading_ico_flag: false,
                      loading_str: a
                  });
        },

        binnd_scroll: function (t) {
            t.detail.scrollTop > 100
                ? this.setData({
                      backtop_flag: true
                  })
                : this.setData({
                      backtop_flag: false
                  });
        },

        backtopFn: function (a) {
            var i = 'scrolltopNum_' + a.currentTarget.dataset.id;
            this.setData(t({}, i, 0));
        },

        onPullDownRefresh() {
            console.log('占位：函数 onPullDownRefresh 未声明');
        }
    }
};
</script>
<style>
@import 'index.css';
</style>
